/*
//              INTEL CORPORATION PROPRIETARY INFORMATION
//  This software is supplied under the terms of a license  agreement or
//  nondisclosure agreement with Intel Corporation and may not be copied
//  or disclosed except in  accordance  with the terms of that agreement.
//    Copyright (c) 2006-2007 Intel Corporation. All Rights Reserved.
//
*/
#include "umc_defs.h"
#if defined (UMC_ENABLE_DV_VIDEO_ENCODER)

#include "umc_dv_enc_compressor_def.h"
#include "ippdefs.h"

namespace UMC
{

 //cos(1*PI/16)
#define CS1 0.980785
 //cos(2*PI/16)
#define CS2 0.923880
 //cos(3*PI/16)
#define CS3 0.831470
 //cos(4*PI/16)
#define CS4 0.707107
 //cos(5*PI/16)
#define CS5 0.555570
 //cos(6*PI/16)
#define CS6 0.382683
 //cos(7*PI/16)
#define CS7 0.195090

#define w0 (0.99999)
#define w1 (CS4 / (4.0 * CS7 * CS2))
#define w2 (CS4 / (2.0 * CS6))
#define w3 (1.0 / (2.0 * CS5))
#define w4 (7.0 / 8.0)
#define w5 (CS4 / CS3)
#define w6 (CS4 / CS2)
#define w7 (CS4 / CS1)
#define count_shift(val) (Ipp16s)((val*(1<<15)) + 0.5)

Ipp16s QTableDouble0[] =
{
    count_shift(0.5000/*76*/),count_shift(w0*w1),count_shift(w0*w2),count_shift(w0*w3),count_shift(w0*w4),count_shift(w0*w5),count_shift(w0*w6),count_shift(w0*w7),
    count_shift(w1*w0),count_shift(w1*w1),count_shift(w1*w2),count_shift(w1*w3),count_shift(w1*w4),count_shift(w1*w5),count_shift(w1*w6),count_shift(w1*w7),
    count_shift(w2*w0),count_shift(w2*w1),count_shift(w2*w2),count_shift(w2*w3),count_shift(w2*w4),count_shift(w2*w5),count_shift(w2*w6),count_shift(w2*w7),
    count_shift(w3*w0),count_shift(w3*w1),count_shift(w3*w2),count_shift(w3*w3),count_shift(w3*w4),count_shift(w3*w5),count_shift(w3*w6),count_shift(w3*w7),
    count_shift(w4*w0),count_shift(w4*w1),count_shift(w4*w2),count_shift(w4*w3),count_shift(w4*w4),count_shift(w4*w5),count_shift(w4*w6),count_shift(w4*w7),
    count_shift(w5*w0),count_shift(w5*w1),count_shift(w5*w2),count_shift(w5*w3),count_shift(w5*w4),count_shift(w5*w5),count_shift(w5*w6),count_shift(w5*w7),
    count_shift(w6*w0),count_shift(w6*w1),count_shift(w6*w2),count_shift(w6*w3),count_shift(w6*w4),count_shift(w6*w5),count_shift(w6*w6),count_shift(w6*w7),
    count_shift(w7*w0),count_shift(w7*w1),count_shift(w7*w2),count_shift(w7*w3),count_shift(w7*w4),count_shift(w7*w5),count_shift(w7*w6),count_shift(w7*w7)
};

Ipp16s QTableDouble1[] =
{
    count_shift(0.5000/*76*/), count_shift(w0*w1),count_shift(w0*w2),count_shift(w0*w3),count_shift(w0*w4),count_shift(w0*w5),count_shift(w0*w6),count_shift(w0*w7),
    count_shift(w2*w0),count_shift(w2*w1),count_shift(w2*w2),count_shift(w2*w3),count_shift(w2*w4),count_shift(w2*w5),count_shift(w2*w6),count_shift(w2*w7),
    count_shift(w4*w0),count_shift(w4*w1),count_shift(w4*w2),count_shift(w4*w3),count_shift(w4*w4),count_shift(w4*w5),count_shift(w4*w6),count_shift(w4*w7),
    count_shift(w6*w0),count_shift(w6*w1),count_shift(w6*w2),count_shift(w6*w3),count_shift(w6*w4),count_shift(w6*w5),count_shift(w6*w6),count_shift(w6*w7),
    count_shift(w0*w0),count_shift(w0*w1),count_shift(w0*w2),count_shift(w0*w3),count_shift(w0*w4),count_shift(w0*w5),count_shift(w0*w6),count_shift(w0*w7),
    count_shift(w2*w0),count_shift(w2*w1),count_shift(w2*w2),count_shift(w2*w3),count_shift(w2*w4),count_shift(w2*w5),count_shift(w2*w6),count_shift(w2*w7),
    count_shift(w4*w0),count_shift(w4*w1),count_shift(w4*w2),count_shift(w4*w3),count_shift(w4*w4),count_shift(w4*w5),count_shift(w4*w6),count_shift(w4*w7),
    count_shift(w6*w0),count_shift(w6*w1),count_shift(w6*w2),count_shift(w6*w3),count_shift(w6*w4),count_shift(w6*w5),count_shift(w6*w6),count_shift(w6*w7)
};

Ipp8s DeZigzagIndex0[] =
{
     0,  1,  8, 16,  9,  2,  3, 10,
    17, 24, 32, 25, 18, 11,  4,  5,
    12, 19, 26, 33, 40, 48, 41, 34,
    27, 20, 13,  6,  7, 14, 21, 28,
    35, 42, 49, 56, 57, 50, 43, 36,
    29, 22, 15, 23, 30, 37, 44, 51,
    58, 59, 52, 45, 38, 31, 39, 46,
    53, 60, 61, 54, 47, 55, 62, 63,


     0, 32,  1, 33,  8, 40,  2, 34,
     9, 41, 16, 48, 24, 56, 17, 49,
    10, 42,  3, 35,  4, 36, 11, 43,
    18, 50, 25, 57, 26, 58, 19, 51,
    12, 44,  5, 37,  6, 38, 13, 45,
    20, 52, 27, 59, 28, 60, 21, 53,
    14, 46,  7, 39, 15, 47, 22, 54,
    29, 61, 30, 62, 23, 55, 31, 63
};

QUANT_STEP TABLE_QS[] =
{
    {1,2,2,3},  {2,3,3,4},  {3,3,4,4},  {4,4,5,5},
    {1,2,2,3},  {2,2,3,3},  {3,3,4,4},  {3,4,4,5},
    {1,1,2,2},  {2,2,3,3},  {2,3,3,4},  {3,4,4,5},
    {1,1,2,2},  {1,2,2,3},  {2,3,3,4},  {3,3,4,4},
    {0,1,1,2},  {1,2,2,3},  {2,2,3,3},  {3,3,4,4}, //4
    {0,1,1,2},  {1,1,2,2},  {2,2,3,3},  {2,3,3,4}, //5
    {0,0,1,1},  {1,1,2,2},  {1,2,2,3},  {2,3,3,4}, //6
    {0,0,1,1},  {0,1,1,2},  {1,2,2,3},  {2,2,3,3}, //7
    {0,0,0,1},  {0,1,1,2},  {1,1,2,2},  {2,2,3,3}, //8
    {0,0,0,0},  {0,0,1,1},  {1,1,2,2},  {1,2,2,3}, //9
    {0,0,0,0},  {0,0,1,1},  {0,1,1,2},  {1,2,2,3}, //10
    {0,0,0,0},  {0,0,0,1},  {0,1,1,2},  {1,1,2,2}, //11
    {0,0,0,0},  {0,0,0,0},  {0,0,1,1},  {1,1,2,2}, //12
    {0,0,0,0},  {0,0,0,0},  {0,0,1,1},  {1,1,1,2}, //13
    {0,0,0,0},  {0,0,0,0},  {0,0,0,1},  {1,1,1,1}, //14
    {0,0,0,0},  {0,0,0,0},  {0,0,0,0},  {1,1,1,1}, //15
};

}//namespace UMC

#endif //(UMC_ENABLE_DV_VIDEO_ENCODER)
